<?php
//ShopProductWrite 类 负责写入数据
class ShopProductWrite{

	public $products =  array();

	public function addProduct(ShopProduct $shopProduct){
		$this->products[] = $shopProduct;
	}
	//write()方法只接受包含ShopProduct1对象 的$shopProduct 参数。
	//public function write(ShopProduct1 $shopProduct)
	public function write( $shopProduct)
	{
		$str = "";
		//foreach($this->products as $shopProduct){
			$str .= "{$shopProduct->title}: ";
			$str .= $shopProduct->getProducer();
			$str .= "({$shopProduct->getPrice()})</BR>";
		//}
		
		print $str;
	}
}


